
// src/pages/CreateVM/Step4Network.tsx
import React from 'react';
import { Form, Select, Input } from 'antd';
import { VMConfig } from './CreateVMWizard';

interface Step4Props {
  config: VMConfig;
  updateConfig: (updates: Partial<VMConfig>) => void;
}

const Step4Network: React.FC<Step4Props> = ({ config, updateConfig }) => {
  return (
    <Form layout="vertical">
      <Form.Item label="网络类型" required>
        <Select
          value={config.networkType}
          onChange={(value) => updateConfig({ networkType: value })}
        >
          <Select.Option value="default">默认网络</Select.Option>
          <Select.Option value="bridge">桥接</Select.Option>
          <Select.Option value="nat">NAT</Select.Option>
        </Select>
      </Form.Item>

      {config.networkType === 'bridge' && (
        <Form.Item label="网络接口">
          <Input
            value={config.networkInterface}
            onChange={(e) => updateConfig({ networkInterface: e.target.value })}
            placeholder="例如: br0"
          />
        </Form.Item>
      )}
    </Form>
  );
};

export default Step4Network;